loadfromfile help

Am I stupid?

I am trying to find the definition for LoadFromFile to try and load an image from a file - I have downloaded the users/programmers and developers manuals (none of which were installed duringthe install process for VCL pro) and cant find (PDF search for loadfromfile) the information anywhere.

Frustrating

Comments

  • edited 12:56PM
    ...
    I am trying to find the definition for LoadFromFile to try and load an image from a file - ...
    We weren't taking about a "function" but about a TPciture.LoadFromFile() method.
    Click in "Fx" icon when you have Designer open.
  • Thanks

    Still having a problem - expect i am being dull

    The script i have for a child band is as follws (tried this in the obp event for the picture as well.

    The picture exists at that location, my report shows (all db fields are OK) but the picture is not displayed



    procedure Child1OnBeforePrint(Sender: TfrxComponent);
    begin
    Picture1.LoadFromFile('e:\temp,jpg');
    end;

    begin
    end.
  • edited 12:56PM
    ...
    The picture exists at that location, my report shows (all db fields are OK) but the picture is not displayed
    First make sure your MasterData and its ChildBand are really printed.
    Put any Memos on them with any simple text inside to verify that.

    Maybe there's something wrong with both bands
    - did you connect MasterData to a DataSet (like TfrxADOTable or TfrxADOQuery),
    - is your Childband Strechable.
  • edited 12:56PM
    And where is your TfrxPictureView placed - on MasterData or Childband?
  • Cheers all

    TfrxPictureView is on the child band

    Masterdata2 (there is no masterdata1) is connected to frxDBDataSet1 which is connected to a UniDac query.

    The textual data (connected to the dataset) on both the child band and the masterband displays correctly.

    To be clear I have the following components

    frxReport1 - dataset and datasetname are uninitialsed
    frxDBDataset1 - dataset is set to a uniquery

    TFrxMasterdata - dataset is frxDBDataset1

    various text components that are connected to frxdataset1

    tfrxPictureView - which is not connected to a dataset

    child band wasnt strected - but changing it so it is made no difference

    hope this sheds some light.


  • edited 12:56PM
    hope this sheds some light.
    Thank you for that ... light [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> It DID help me to see[/img]a comma in
    - Picture1.LoadFromFile('e:\temp,jpg')

    There should be a dot
    - Picture1.LoadFromFile('e:\temp.jpg')

    But I'm not sure it really could be such an issue >
  • You are right - re the ,/. I am so used to a compiler picking up errors and generating exceptions

    But changing it to a . didn't make any difference [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Interestingly though I have the following. I place a TfrxPicture in the report title and have the obp as above I have a second TfrxPicture in the child band with the same obp code (picture1 and picture2). If I preview the report - temp.jpg is displayed correctly in the header but not in the child band If I run my program and trigger the report with frxReport1->ShowReport() then neither tfrxPicture shows temp.jpg does this help?[/img]
  • edited 12:56PM
    You are right - re the ,/. I am so used to a compiler picking up errors and generating exceptions
    That comma was inside a string constant - I think no compiler can recognize that.

    I did small test (Delphi BDS 2006) as I have no idea about C++
    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    begin
      TfrxPictureView(Sender).Picture.LoadFromFile('v:\wall.jpg');  
    end;
    
    And it worked fine.
  • wrote:
    That comma was inside a string constant - I think no compiler can recognize that.
    True [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I used the same pascal code as you (other than the filename) and again it works in the preview but not when I run the report proper. procedure Picture2OnBeforePrint(Sender: TfrxComponent); begin TfrxPictureView(Sender).Picture.LoadFromFile('e:\temp.jpg'); end; This seems to make me think it is related to how I have connected the different FR objects to my data.[/img]
  • edited 12:56PM
    ...
    This seems to make me think it is related to how I have connected the different FR objects to my data.
    I did my test with a very (!) simple report - one of demos with master and detail. And my Picture1 was located on a MasterData.
    I suggest you to try again with a simple report with one MasterData and TfrxPictureView placed on it.
    This may help to avoid any influence of other things we even don't know.
  • Mick.pl wrote: »
    Mick.pl wrote: »
    ...
    This seems to make me think it is related to how I have connected the different FR objects to my data.
    I did my test with a very (!) simple report - one of demos with master and detail. And my Picture1 was located on a MasterData.
    I suggest you to try again with a simple report with one MasterData and TfrxPictureView placed on it.
    This may help to avoid any influence of other things we even don't know.

    Thanks Mick

    I tries the same but unfortunately with the same results. I just have a reporttitle and a masterdata.

    I must be doing something very simple wrong
  • edited February 2013
    OK started again and this is my steps

    Place TfrxReport1 on form
    Place TfrxDBDataset on form
    Set frxReport1 dataset property to frxDBdataset1 (I later delete this)
    Set Dataset property of TfrxDBdataset to a TUniQuery

    Open frxReport1
    Add frxDBdataset1 to report via report|data menu

    Add masterdata to report and set dataset to frxdbdataset1

    From Data Tree drag a text column to masterdat (just to show that all is working at that level
    Add a TfrxPictureView to the form ??? don???t assign a picture

    In the pictures obp add event code ??? code now looks like
    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    begin
           TfrxPictureView(Sender).Picture.LoadFromFile('e:\temp.jpg');                                  
    end;
    
    begin
    end.
    

    Preview report get error cannot use same dataset for report.dataset and band.dataset

    So clear report dataset property

    Report runs, text field displays OK but no picture displayed

    Hope that shows where I am going wrong - suspect it might be to do with how I connect datasets but i cant see why.
  • gordkgordk St.Catherines On. Canada.
    edited 12:56PM
    your first mistake was connecting the tfrxreport component to a dataset, this is usually used
    in multi designpage reports to tell the number of times to run the report.

    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    begin
    //TfrxPictureView(Sender).Picture.LoadFromFile('e:\temp.jpg');
    //should be
    picture1.loadfromfile('e:\temp.jpg');
    // or if you were loading this info from a db field
    picture1.loadfromfile(<Datasetname."fieldname">);

    end;

  • Thanks gordk

    Sort of making progress - Now when I preview the report I see text field and temp.jpg once for each record as expected.

    But when i run the report

    frxReport1->ShowReport();

    I see my text field (once for each record) but no picture.

    What could be different between previewing the report in the designer and showing the report. I knopw the query is running OK becuase I get the text values for each record. its just the picture that seems to be the problem.
  • gordkgordk St.Catherines On. Canada.
    edited 12:56PM
    What windows system are you running under and are you delphi or c
  • gordk wrote: »
    What windows system are you running under and are you delphi or c

    Win 7 x64 using embarcadero builder C++ Xe3 with Devart UniDac components connected to a DevExpress grid
  • gordkgordk St.Catherines On. Canada.
    edited 12:56PM
    are you saving the report design file as a .fr3 or storing it in the dfm?

  • gordk wrote: »
    are you saving the report design file as a .fr3 or storing it in the dfm?

    I haven't saved the report as yet just closed the designer and run my program.

    Slight development though. I created a new project and connected to the same dataset and ran the report and all was ok. I have checked and I have configured the components in exactly the same way.

    Confused as to why the pictures show in both previews but in one report but not in the other.

    Frustrating - very much appreciate the help though.
  • gordkgordk St.Catherines On. Canada.
    edited 12:56PM
    i would expect something amiss in the original project when you run it. you maybe calling the wrong tfrxreport component to show report
  • only one tfrxcomponent - as I said ealier, and at your suggestion, I restarted and kept the report very basic. just one masterdata one frxmemoview and one frxpictureview. If I can get the basics working then I'll work on the more difficult bits
  • I odnt know if this is relevant but I thought I would try saving a report rather than displaying it. So I added a frxPDFExport component to my application when I compile I get

    error reading frxPDFExport1.Quality Property, Quality does not exist

    I am wondering whether I need to reinstall XE3 but exclude the FR components and the reinstall FR4
  • gordkgordk St.Catherines On. Canada.
    edited 12:56PM
    that would be a good idea it sounds more and more like that is the problem.
    here is what i would try first use fr's unistaller to remove fr4
    delete the fastreports/fastreport 4 folder
    use xe3's installer to repair removing the fastreport components.
    install your purchased version of fr4.
    run frs recompiler if you need to change settings for tchart version
  • I think that has done the job.

    Cheers

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.